package com.hanter.android.radui.dialog;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

/**
 * 类名：BaseDialog <br/>
 * 描述：避免报错的DialogFragment
 * 创建时间：2020/06/09 13:38
 *
 * @author panxi
 * @version 1.0
 */
public class MyDialogFragment extends DialogFragment {

    @Override
    public void show(@NonNull FragmentManager manager, @Nullable String tag) {
        try {
            super.show(manager, tag);
        } catch (IllegalStateException ignored) { }
    }

    @Override
    public int show(@NonNull FragmentTransaction transaction, @Nullable String tag) {
        try {
            return super.show(transaction, tag);
        } catch (IllegalStateException ignored) {
            return -1;
        }
    }

    @Override
    public void dismiss() {
        try {
            super.dismiss();
        } catch (IllegalStateException ignored) { }
    }

    @Override
    public void dismissAllowingStateLoss() {
        try {
            super.dismissAllowingStateLoss();
        } catch (IllegalStateException ignored) { }

    }

}
